package chz.emarket.web.controller;

import java.security.NoSuchAlgorithmException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import chz.emarket.exception.WebException;
import chz.emarket.model.Person;
import chz.emarket.service.PersonService;

@Controller
public class emarket {
	@Autowired
	public PersonService personService;
	
	@RequestMapping("/md5.html")
	@ResponseBody
	public String md5() throws WebException,NoSuchAlgorithmException {
		Md5PasswordEncoder md5Encoder = new Md5PasswordEncoder();
		String md5Str = md5Encoder.encodePassword("123", null);                                                                                                                                                                                                                                        
		return md5Str;
	} 
	
//	@RequestMapping("/login.html")
//	public ModelAndView login(HttpServletRequest request, HttpServletResponse response) {
//		//ModelAndView mv = new ModelAndView();
//		Person user = personService.getPersonById(1);
//		
//		
//		return new ModelAndView("login", "user", user); 
//		
//	}

	
	

}